package com.example.demo.controller.AuthorControl;

import com.example.demo.entity.BackResponseEntity;
import com.example.demo.entity.requestJson.DeleteReq;
import com.example.demo.entity.responseJson.HomePageBMoreInfoRes;
import com.example.demo.entity.responseJson.PerSpaceAInfoRes;
import com.example.demo.service.APersonalSpaceService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : 洪俊新
 * @date : 2021/3/9 17:14
 * @description:
 */
@RestController
@RequestMapping("/author/space")
@Api(value = "作者个人中心接口", tags = "作者个人中心接口")
public class APerSpaceController {
    @Autowired
    private APersonalSpaceService aPersonalSpaceService;

    @ApiOperation(value = "作者主页作者基本信息接口", notes = "传author_id")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @GetMapping("/authorbaseinfo")
    public BackResponseEntity<PerSpaceAInfoRes> queryAname(DeleteReq deleteReq) {
        return aPersonalSpaceService.queryHomepageAuthorInfo(deleteReq);
    }

    @ApiOperation(value = "作者个人空间作品列表", notes = "传author_id")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )

    @GetMapping("/queryworks")
    public BackResponseEntity<List<HomePageBMoreInfoRes>> queryWorks(DeleteReq deleteReq) {
        return aPersonalSpaceService.queryWorks(deleteReq);
    }
}
